package com.fjnu.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.fjnu.dao.IUserDao;
import com.fjnu.dao.common.BaseDaoImpl;
import com.fjnu.dao.common.DaoException;
import com.fjnu.entities.User;
@Repository("userDao")
public class UserDao extends BaseDaoImpl<User> implements IUserDao {

	
	public User loginFindUnique(User user) {
		String idnumber=user.getIdnumber();
		//System.out.println(idnumber);
		String hql = "from User where idnumber = ?";
		List<User> listUser = findByHQL(hql,idnumber);
		//System.out.println("ddd"+listUser.get(0));
		if(listUser.size()==0){
			throw new DaoException("用户不存在");
		}
		return listUser.get(0);
	}

}
